{include file="common/header"}
<style>
   
    .table-responsive .cap-center th,.table-responsive table tbody td{
        text-align: center !important;
    }
    /*定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸*/
    ::-webkit-scrollbar
    {
        height: 8px;
        background-color: #F5F5F5;
    }
    /*定义滚动条轨道 内阴影+圆角*/
    ::-webkit-scrollbar-track
    {
        border-radius: 3px;
    }
    /*定义滑块 内阴影+圆角*/
    ::-webkit-scrollbar-thumb
    {
        border-radius: 3px;
    }
    
</style>
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox">
                    <div class="ibox-title">
                        <h5>提现审核列表</h5>
                    </div>
                    <div class="ibox-content">
                        <div class="row" style="margin-bottom: 15px;">
                            <div class="col-sm-12">
                                <div class="input-group col-sm-12">
                                    <form method="get" action="" class="pull-left" style="">
                                        <input type="hidden" name="p" value="1" title="分页次页搜索需要">
                                        <input type="text" name="user_name" value="<?php if(isset($_GET['user_name']) && $_GET['user_name']){echo $_GET['user_name'];} ?>" placeholder="用户名" class="input-sm form-control " style="width:150px;font-size:12px;" >
                                        <select style="width: 110px;margin-left: 5px;margin-right: 5px;font-size: 12px;" name="status" class="input-sm form-control input-s-sm inline">
                                            <option <?php echo (!isset($_GET['status']) || $_GET['status'] == 'all') ? 'selected="selected"' : ''; ?> value="all">全部</option>
                                            <option <?php echo (isset($_GET['status']) && $_GET['status'] != 'all' && $_GET['status'] == 0) ? 'selected="selected"' : ''; ?> value="0">未审核</option>
                                            <option <?php echo (isset($_GET['status']) && $_GET['status'] != 'all' && $_GET['status'] == 1) ? 'selected="selected"' : ''; ?> value="1">已通过</option>
                                            <option <?php echo (isset($_GET['status']) && $_GET['status'] != 'all' && $_GET['status'] == 2) ? 'selected="selected"' : ''; ?> value="2">已拒绝</option>
                                        </select>
                                        <span class="input-group-btn pull-left">
                                            <button type="submit" class="btn btn-sm btn-primary search-btn"> 搜索</button>
                                        </span>
                                    </form>
                                    <div  style=""  class="pull-left">
                                     <button type="button" style="margin-left: 10px;" onclick="javascript:window.location.href = '/Admin/Member/tx_auditing_list';" class="btn btn-danger btn-sm  reset-btn pull-left">刷新</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="tab-content">
                            <div class="alert alert-warning">
                                <b>提示：</b>共找到<b> <?php echo $count; ?> </b>个提现审核
                            </div>
                            <div id="tab-1" class="tab-pane active">
                                <div class="full-height-scroll">
                                    <div class="table-responsive">
                                        <table class="table table-striped table-hover">
                                            <tbody>
                                                <tr class="cap-center">
                                                    <td>序号</td>
                                                    <td>头像</td>
                                                    <td>用户名</td>
                                                    <td>提现金额（元）</td>
                                                    <td>账号类型</td>
                                                    <td>提现账号</td>
                                                    <td>提现时间</td>
                                                    <td>审核状态</td>
                                                    <td>操作</td>
                                                </tr>
                                                <?php foreach($res as $k => $v): ?>
                                                <tr id="tr_<?php echo $v['id'] ?>" title="<?php echo $v['note'] ?>">
                                                    <td><?php echo ++ $page['firstRow']; ?></td>
                                                    <td><img style="width:50PX;" src="<?php echo $v['user_img']; ?>" alt=""></td>
                                                    <td><?php echo $v['user_name']; ?></td>
                                                    <td><?php echo $v['price']; ?></td>
                                                    <td><?php echo $v['zh_type']; ?></td>
                                                    <td><?php echo $v['zh']; ?></td>
                                                    <td><?php echo $v['add_time']; ?></td>
                                                    <td><?php echo $v['str_type']; ?></td>
                                                    <td>
                                                        <?php if($v['type'] == 0){ ?>
                                                        <a href="javascript:passContent(<?php echo $v['id']; ?>);"><span class="label label-primary">通过</span></a>
                                                        <a href="javascript:refuseContent(<?php echo $v['id']; ?>);"><span class="label label-danger">拒绝</span></a>
                                                        <?php } ?> 
                                                        <a href="javascript:remark(<?php echo $v['id']; ?>,'<?php echo $v['user_name']; ?>');"><span class="label label-info">备注</span></a>
                                                    </td>
                                                </tr>
                                                <?php endforeach; ?>
                                            </tbody>
                                        </table>
                                    </div>
                                    <tfoot>
                                        <tr>
                                            <td colspan="12">
                                                <div class="b-page">
                                                    <?php echo $page['page']; ?>
                                                </div>
                                            </td>
                                        </tr>
                                    </tfoot>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
<script>

    function showDetail(content){
        swal({ 
          title: "",
          text: "<h4>"+content+"</h4>", 
          html: true 
        });
    }

    var flog2 = false;
    function passContent(id){
        swal({
            title: "确认通过审核吗？",
            text: "谨慎操作",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "确认通过",
            cancelButtonText: "考虑一下",
            closeOnConfirm: false,
            closeOnCancel: true
        },
        function(isConfirm) {
            if (isConfirm) {
                if (flog2) {
                    return;
                }
                flog2 = true;
                $.post('/Admin/Member/tx_auditing_pass',{id:id},function(d){
                    flog2 = false;
                    if(d.error)
                    {
                        swal(d.msg, "", "error");
                        return false;
                    }else{
                        swal(d.msg, "", "success");
                        setTimeout("window.location.reload();",1000);
                    }
                },'json');
            }
        });
        
    }

    function refuseContent(id){
        swal({
            title: "确认拒绝审核吗？",
            text: "谨慎操作",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "确认拒绝",
            cancelButtonText: "考虑一下",
            closeOnConfirm: false,
            closeOnCancel: true
        },
        function(isConfirm) {
            if (isConfirm) {
                if (flog2) {
                    return;
                }
                flog2 = true;
                $.post('/Admin/Member/tx_auditing_refuse',{id:id},function(d){
                    flog2 = false;
                    if(d.error)
                    {
                        swal(d.msg, "", "error");
                        return false;
                    }else{
                        swal(d.msg, "", "success");
                        setTimeout("window.location.reload();",1000);
                    }
                },'json');
            }
        });
        
    }

    function remark(id,user_name){
        var val = $('#tr_'+id).attr('title');
        swal({
            title: "添加备注",
            text: "用户名："+user_name,
            type: "input",
            showCancelButton:true,
            closeOnConfirm:false,
            confirmButtonText:"确认",
            cancelButtonText:"取消",
            animation: "slide-from-top",
            inputPlaceholder: "输入备注信息",
            inputValue:val
        },
        function (inputValue){
            if(inputValue){
                $.post('/Admin/Member/tx_remark',{id:id,remark:inputValue},function(d){
                    flog2 = false;
                    if(d.error)
                    {
                        swal(d.msg, "", "error");
                        return false;
                    }else{
                        swal(d.msg, "", "success");
                        setTimeout("window.location.reload();",1000);
                    }
                },'json');                    
            }else{
                swal("备注不能为空");    
            }
        });
    }

</script>
{include file="common/footer"}